Package i2p :: Module BaseHTTPServer
[show private | hide private]
[frames | no frames]

Module i2p.BaseHTTPServer

Emulation of Python BaseHTTPServer module using I2P sockets.

The Python module is described at http://www.python.org/doc/current/lib/module-BaseHTTPServer.html

To get a server going, use:
>>> from i2p import BaseHTTPServer
>>> BaseHTTPServer.test().

Consult the documentation for function test() to change basic server settings, such as the session name.

A fully customizable example:
>>> from i2p import BaseHTTPServer
>>> session = "mytestxxx.i2p"      # SAM session name
>>> class MyServer(BaseHTTPServer.HTTPServer): pass
>>> class MyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): pass
>>> httpd = MyServer(session, MyRequestHandler)
>>> httpd.socket.dest
(Base64 Destination of server)

>>> httpd.serve_forever()

Classes
BaseHTTPRequestHandler Same interface as Python class BaseHTTPServer.BaseHTTPRequestHandler.
HTTPServer Same interface as Python class BaseHTTPServer.HTTPServer.

Function Summary
  test(HandlerClass, ServerClass, protocol, session)
Test the HTTP request handler class.

Variable Summary
str __version__ = '0.3'
str DEFAULT_ERROR_MESSAGE = '<head>\n<title>Error response</...

Function Details

test(HandlerClass=<class i2p.BaseHTTPServer.BaseHTTPRequestHandler at 0x00A..., ServerClass=<class i2p.BaseHTTPServer.HTTPServer at 0x00A2D960>, protocol='HTTP/1.0', session='mytestxxx.i2p')

Test the HTTP request handler class.

This runs an I2P TCP server under SAM session 'session'. If a single command line argument is given, the argument is used instead as the SAM session name.

Variable Details

__version__

Type:
str
Value:
'0.3'                                                                  

DEFAULT_ERROR_MESSAGE

Type:
str
Value:
'''<head>
<title>Error response</title>
</head>
<body>
<h1>Error response</h1>
<p>Error code %(code)d.
<p>Message: %(message)s.
<p>Error code explanation: %(code)s = %(explain)s.
...                                                                    

Generated by Epydoc 2.1 on Mon Aug 02 01:07:41 2004 http://epydoc.sf.net